<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript" src="../js/vue.js">

		</script>
		<script src="../js/vue-router.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<router-link to="/login?name='张三'">
				登录
			</router-link>

			<router-link to="/register?id=10">
				注册
			</router-link>
			<router-view></router-view>
		</div>
		<script>
			var login = {
				template: '<h1 style="color:hotpink;">登录--------{{$route.query.name}}</h1>'
			}
			var register = {
				template: '<h1 style="color:hotpink;">注册--------{{$route.query.id}}</h1>'
			}
			var router = new VueRouter({
				routes: [{
						path: '/',
						redirect: '/login'
					}, {
						path: '/login',
						component: login
					},
					{
						path: '/register',
						component: register
					}
				]
			})
			new Vue({
		
				el: '#app',
				data: {},
				methods: {},
				router: router,
				created(){
					console.log(this)
				},
			})
		</script>
	</body>
</html>
